function imgurl(src){
	return '/static/image/' + src + '.png'
}
// 上传图片
function updownImage(){
	return new Promise((resolve, reject) => {
		uni.chooseImage({
			count: 1,
		    success: (chooseImageRes) => {
		        const tempFilePaths = chooseImageRes.tempFilePaths;
		        uni.uploadFile({
		            url: process.uniEnv.BASE_API + '/oss/uploadFile',
		            filePath: tempFilePaths[0],
		            name: 'file',
		            success: (uploadFileRes) => {
						resolve(uploadFileRes.data)
		            },
					fail: (err) => {
						reject(err)
					}
		        })
		    }
		})
	})
}
// 校验是否登录（token)
function isLogin(item){
	let token = uni.getStorageSync('token')
	if(!token){
		uni.navigateTo({
			url: '/pages/login/login?url=' + item
		})
		return false
	}else{
		return true
	}
}
let visitUrl = ''
export default {
	imgurl,
	visitUrl,
	updownImage,
	isLogin
}